package.path = "./?.lua"

O={}




function print_table(t)
	for k,v in pairs(t) do
		if type(v) == "table" then
			print("key" .. k .. "---------------")
			print_table(v)
		else
			print("key = " .. k .. ", val = " .. v)
		end

	end
	return 1,2
end


function O:req()
	print("hello")
	print_table(self)

end

f = O["req"]

args = { a="1", b="2"}

f( args)


t = {}

table.insert(t, { c = 3})

table.insert(t, {["123"] = 1 })

table.insert(t, {[100] = 1222 })


n,m = print_table(t)

local tab = {1,2,3,4}

table.remove(tab, 1)


-- print_table(tab)


print("####################")

function pack(...)
    return { n = select("#", ...), ... }
	--continue
end

print_table(pack(1,3,4,5,6,7))

print("####################")

local tab = {1,2,3,4}
local t3 = {}
local i = 1
for k, v in pairs(tab) do
	print(k  .. v)
	table.remove(tab, k)
end

print_table(tab)

if #t3 then
	print("ttt333")
end

local m = 10
for i = 1, m do
	print(i)
	m = 5
end


local function partition( tab,  predicate)

    local part1 = {}
    local part2 = {}

    for k, v in pairs(tab) do
        if predicate(k, v) then
            table.insert(part1, v)
        else
            table.insert(part2, v)
        end
    end

    return part1, part2
end


local tt1, tt2 = partition({1,2,3,4,5}, function(_, v)  return v > 3 end)

print_table(tt1)
print("--------")
print_table(tt2)

